package com.example.s02jsp.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Date;

@Controller
public class WelcomeController
{

    // @GetMapping 等同于  @RequestMapping(value = "/test1",method = RequestMethod.GET)
    @GetMapping("/test1")
    public String test1(Model m)
    {
        m.addAttribute("time",new Date());
        m.addAttribute("message","Hello world");
        return "hello";
    }
}
